/*
 *  Property Mapper, simple automatic GUI generator for JavaBeans using annotations.
 *  Copyright (C) 2008 Jon Lennersten, Johan Hedin
 *
 *  This file is part of Property Mapper.
 *
 *  Property Mapper is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Property Mapper is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Property Mapper.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.mawell.common.propertymapper;

import java.lang.reflect.Method;

/**
 * Base class for the configuration of an object
 *
 * @version $Id: PropertyConfiguration.java,v 1.2 2007/03/09 11:22:02 michael Exp $
 * @see com.mawell.common.propertymapper.PropertyMapper
 */
public abstract class PropertyConfiguration {

    private String property;
    private String description;
    private boolean mandatory;
    protected Method get;
    protected Method set;

    /**
     * Get the affected property
     *
     * @return The affected property
     */
    public String getProperty() {
        return property;
    }

    /**
     * Set the affected property
     *
     * @param property The affected property
     */
    public void setProperty(String property) {
        this.property = property;
    }

    /**
     * Get the description
     *
     * @return The description
     */
    public String getDescription() {
        return description;
    }

    /**
     * Set the description
     *
     * @param description The description
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * Is this property mandatory
     *
     * @return true if this property cannot be empty/null
     */
    public boolean isMandatory() {
        return mandatory;
    }

    /**
     * Set if this property is mandatory
     *
     * @param mandatory true if this property cannot be empty/null
     */
    public void setMandatory(boolean mandatory) {
        this.mandatory = mandatory;
    }

    /**
     * Returns if the property is set, should be overridden
     *
     * @return if the property is set
     */
    public abstract boolean isSet();
    
    /**
     * Accept a visitor to visit this configuration.
     * 
     * @param the <code>PropertyConfigurationVisitor</code> to accept
     */
    public abstract void accept(PropertyConfigurationVisitor visitor);    
}